import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkPriceConfigVO, ParkPriceConfigForm, ParkPriceConfigQuery } from '@/api/park/parkPriceConfig/types';

/**
 * 查询价格配置列表
 * @param query
 * @returns {*}
 */

export const listParkPriceConfig = (query?: ParkPriceConfigQuery): AxiosPromise<ParkPriceConfigVO[]> => {
  return request({
    url: '/park/parkPriceConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询价格配置详细
 * @param priceConfigId
 */
export const getParkPriceConfig = (priceConfigId: string | number): AxiosPromise<ParkPriceConfigVO> => {
  return request({
    url: '/park/parkPriceConfig/' + priceConfigId,
    method: 'get'
  });
};

/**
 * 新增价格配置
 * @param data
 */
export const addParkPriceConfig = (data: ParkPriceConfigForm) => {
  return request({
    url: '/park/parkPriceConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改价格配置
 * @param data
 */
export const updateParkPriceConfig = (data: ParkPriceConfigForm) => {
  return request({
    url: '/park/parkPriceConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除价格配置
 * @param priceConfigId
 */
export const delParkPriceConfig = (priceConfigId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkPriceConfig/' + priceConfigId,
    method: 'delete'
  });
};
